# RUN: llvm-mc -arch=amdgcn -mcpu=gfx1010 -disassemble -show-encoding %s | FileCheck -check-prefix=GFX10 %s

#===----------------------------------------------------------------------===//
# Inline constants
#===----------------------------------------------------------------------===//

# GFX10: v_pk_add_f16 v1, 0, v2          ; encoding: [0x01,0x40,0x0f,0xcc,0x80,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x80,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, v2, 0          ; encoding: [0x01,0x40,0x0f,0xcc,0x02,0x01,0x01,0x18]
0x01,0x00,0x0f,0xcc,0x02,0x01,0x01,0x18

# GFX10: v_pk_add_f16 v1, 1.0, v2        ; encoding: [0x01,0x40,0x0f,0xcc,0xf2,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf2,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -1.0, v2       ; encoding: [0x01,0x40,0x0f,0xcc,0xf3,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf3,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -0.5, v2       ; encoding: [0x01,0x40,0x0f,0xcc,0xf1,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf1,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 0.5, v2        ; encoding: [0x01,0x40,0x0f,0xcc,0xf0,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf0,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 2.0, v2        ; encoding: [0x01,0x40,0x0f,0xcc,0xf4,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf4,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -2.0, v2       ; encoding: [0x01,0x40,0x0f,0xcc,0xf5,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf5,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 4.0, v2        ; encoding: [0x01,0x40,0x0f,0xcc,0xf6,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf6,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -4.0, v2       ; encoding: [0x01,0x40,0x0f,0xcc,0xf7,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf7,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 0.15915494, v2 ; encoding: [0x01,0x40,0x0f,0xcc,0xf8,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xf8,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -1, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0xc1,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xc1,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -2, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0xc2,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xc2,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -3, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0xc3,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xc3,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, -16, v2        ; encoding: [0x01,0x40,0x0f,0xcc,0xd0,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xd0,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 1, v2          ; encoding: [0x01,0x40,0x0f,0xcc,0x81,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x81,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 2, v2          ; encoding: [0x01,0x40,0x0f,0xcc,0x82,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x82,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 3, v2          ; encoding: [0x01,0x40,0x0f,0xcc,0x83,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x83,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 4, v2          ; encoding: [0x01,0x40,0x0f,0xcc,0x84,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x84,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 15, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0x8f,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x8f,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 16, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0x90,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0x90,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 63, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0xbf,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xbf,0x04,0x02,0x18

# GFX10: v_pk_add_f16 v1, 64, v2         ; encoding: [0x01,0x40,0x0f,0xcc,0xc0,0x04,0x02,0x18]
0x01,0x00,0x0f,0xcc,0xc0,0x04,0x02,0x18

# GFX10: v_pk_fma_f16 v5, 1.0, 2.0, 4.0  ; encoding: [0x05,0x40,0x0e,0xcc,0xf2,0xe8,0xd9,0x1b]
0x05,0x40,0x0e,0xcc,0xf2,0xe8,0xd9,0x1b

# GFX10: v_pk_fma_f16 v5, -1, -2, -3     ; encoding: [0x05,0x40,0x0e,0xcc,0xc1,0x84,0x0d,0x1b]
0x05,0x40,0x0e,0xcc,0xc1,0x84,0x0d,0x1b

# GFX10: v_pk_mad_i16 v5, 0x3c00, 0x4000, 0x4400  ; encoding: [0x05,0x40,0x00,0xcc,0xff,0xfe,0xfd,0x1b,0x00,0x3c,0x00,0x00]
0x05,0x40,0x00,0xcc,0xf2,0xe8,0xd9,0x1b

# GFX10: v_pk_mad_u16 v5, -1, -2, -3     ; encoding: [0x05,0x40,0x09,0xcc,0xc1,0x84,0x0d,0x1b]
0x05,0x40,0x09,0xcc,0xc1,0x84,0x0d,0x1b

# GFX10: v_pk_ashrrev_i16 v5, 1, 16      ; encoding: [0x05,0x40,0x06,0xcc,0x81,0x20,0x01,0x18]
0x05,0x00,0x06,0xcc,0x81,0x20,0x01,0x18

#===----------------------------------------------------------------------===//
# 32-bit literals
#===----------------------------------------------------------------------===//

# GFX10: v_pk_add_f16 v5, v1, 0x12345678 ; encoding: [0x05,0x40,0x0f,0xcc,0x01,0xff,0x01,0x18,0x78,0x56,0x34,0x12]
0x05,0x00,0x0f,0xcc,0x01,0xff,0x01,0x18,0x78,0x56,0x34,0x12

# GFX10: v_pk_add_f16 v5, 0x12345678, v2 ; encoding: [0x05,0x40,0x0f,0xcc,0xff,0x04,0x02,0x18,0x78,0x56,0x34,0x12]
0x05,0x00,0x0f,0xcc,0xff,0x04,0x02,0x18,0x78,0x56,0x34,0x12

# GFX10: v_pk_add_f16 v5, 0xffffff00, v2 ; encoding: [0x05,0x40,0x0f,0xcc,0xff,0x04,0x02,0x18,0x00,0xff,0xff,0xff]
0x05,0x00,0x0f,0xcc,0xff,0x04,0x02,0x18,0x00,0xff,0xff,0xff

# GFX10: v_pk_add_f16 v5, v1, 0x100 ; encoding: [0x05,0x40,0x0f,0xcc,0x01,0xff,0x01,0x18,0x00,0x01,0x00,0x00]
0x05,0x00,0x0f,0xcc,0x01,0xff,0x01,0x18,0x00,0x01,0x00,0x00

# GFX10: v_pk_add_u16 v5, v1, 0x12345678 ; encoding: [0x05,0x40,0x0a,0xcc,0x01,0xff,0x01,0x18,0x78,0x56,0x34,0x12]
0x05,0x00,0x0a,0xcc,0x01,0xff,0x01,0x18,0x78,0x56,0x34,0x12

# GFX10: v_pk_add_u16 v5, 0x12345678, v2 ; encoding: [0x05,0x40,0x0a,0xcc,0xff,0x04,0x02,0x18,0x78,0x56,0x34,0x12]
0x05,0x00,0x0a,0xcc,0xff,0x04,0x02,0x18,0x78,0x56,0x34,0x12

# GFX10: v_pk_add_u16 v5, 0xffffff00, v2 ; encoding: [0x05,0x40,0x0a,0xcc,0xff,0x04,0x02,0x18,0x00,0xff,0xff,0xff]
0x05,0x00,0x0a,0xcc,0xff,0x04,0x02,0x18,0x00,0xff,0xff,0xff

# GFX10: v_pk_add_u16 v5, v1, 0x100 ; encoding: [0x05,0x40,0x0a,0xcc,0x01,0xff,0x01,0x18,0x00,0x01,0x00,0x00]
0x05,0x00,0x0a,0xcc,0x01,0xff,0x01,0x18,0x00,0x01,0x00,0x00

# GFX10: v_pk_fma_f16 v5, 0xaf123456, v2, v3 ; encoding: [0x05,0x40,0x0e,0xcc,0xff,0x04,0x0e,0x1c,0x56,0x34,0x12,0xaf]
0x05,0x40,0x0e,0xcc,0xff,0x04,0x0e,0x1c,0x56,0x34,0x12,0xaf

# GFX10: v_pk_fma_f16 v5, v1, 0xaf123456, v3 ; encoding: [0x05,0x40,0x0e,0xcc,0x01,0xff,0x0d,0x1c,0x56,0x34,0x12,0xaf]
0x05,0x40,0x0e,0xcc,0x01,0xff,0x0d,0x1c,0x56,0x34,0x12,0xaf

# GFX10: v_pk_fma_f16 v5, v1, v2, 0xaf123456 ; encoding: [0x05,0x40,0x0e,0xcc,0x01,0x05,0xfe,0x1b,0x56,0x34,0x12,0xaf]
0x05,0x40,0x0e,0xcc,0x01,0x05,0xfe,0x1b,0x56,0x34,0x12,0xaf

# GFX10: v_pk_mad_i16 v5, 0xaf123456, v2, v3 ; encoding: [0x05,0x40,0x00,0xcc,0xff,0x04,0x0e,0x1c,0x56,0x34,0x12,0xaf]
0x05,0x40,0x00,0xcc,0xff,0x04,0x0e,0x1c,0x56,0x34,0x12,0xaf

# GFX10: v_pk_mad_i16 v5, v1, 0xaf123456, v3 ; encoding: [0x05,0x40,0x00,0xcc,0x01,0xff,0x0d,0x1c,0x56,0x34,0x12,0xaf]
0x05,0x40,0x00,0xcc,0x01,0xff,0x0d,0x1c,0x56,0x34,0x12,0xaf

# GFX10: v_pk_mad_i16 v5, v1, v2, 0xaf123456 ; encoding: [0x05,0x40,0x00,0xcc,0x01,0x05,0xfe,0x1b,0x56,0x34,0x12,0xaf]
0x05,0x40,0x00,0xcc,0x01,0x05,0xfe,0x1b,0x56,0x34,0x12,0xaf

# GFX10: v_pk_ashrrev_i16 v5, 0x12345678, v2 ; encoding: [0x05,0x40,0x06,0xcc,0xff,0x04,0x02,0x18,0x78,0x56,0x34,0x12]
0x05,0x00,0x06,0xcc,0xff,0x04,0x02,0x18,0x78,0x56,0x34,0x12

# GFX10: v_pk_ashrrev_i16 v5, v1, 0x12345678 ; encoding: [0x05,0x40,0x06,0xcc,0x01,0xff,0x01,0x18,0x78,0x56,0x34,0x12]
0x05,0x00,0x06,0xcc,0x01,0xff,0x01,0x18,0x78,0x56,0x34,0x12

#===----------------------------------------------------------------------===//
# Packed VOP2
#===----------------------------------------------------------------------===//

# FIXME: v_pk_fmac_f16 cannot be promoted to VOP3 so '_e32' suffix is not valid
# GFX10: v_pk_fmac_f16 v5, 0x12345678, v2 ; encoding: [0xff,0x04,0x0a,0x78,0x78,0x56,0x34,0x12]
0xff,0x04,0x0a,0x78,0x78,0x56,0x34,0x12
